<template>
    <div class="layui-fluid">
        <div class="layui-row">
            <form class="layui-form" v-model="singleLead">
                <input type="text" style="display: none" v-model="singleLead.id">
                <div class="layui-form-item" style="padding-top: 60px">
                    <label class="layui-form-label">
                        <span class="x-red">*</span>领取原因</label>
                    <div class="layui-input-inline">
                        <input type="text" required="" class="layui-input" v-model="log">
                    </div>
                </div>
                <div style="text-align: center">
                    <button class="layui-btn" @click="submitForm(singleLead)">领取</button>
                </div>
            </form>
        </div>
    </div>
</template>

<script>
    import { mapActions, mapState } from "vuex";
    import service from "../../../src/service";
    export default {
        data(){
            return{
                log:""
            }
        },
        props:['singleLead'],
        name: "leadtakelog",
        methods:{
            submitForm(data){
                var lead = {
                    "leadid":data.id,
                    "logcontent":this.log
                }
                service.instance().post("http://"+window.location.hostname+":8011/lead/take",lead)
                    .then((response)=> {
                        if(response.data == "1"){
                            this.getleads();
                            this.$layer.alert("修改成功");
                            parent.closeAll()
                        }
                    })
            },
            ...mapActions(["getleads"])
        },
        computed:{

        },
        mounted() {

        }
    }
</script>

<style scoped>

</style>